CSharpTest.Net
ToByteArray(Byte[],Int32) Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Data Namespace > DbGuid Structure > ToByteArray Method : ToByteArray(Byte[],Int32) Method

bytes
offset

Glossary Item Box

Copies the big-endian byte array to the offset supplied, not compatible with System.Guid.ToByteArray.

Syntax

Visual Basic (Declaration) 
Public Overloads Sub ToByteArray( _
   ByVal bytes() As Byte, _
   ByVal offset As Integer _
) 
C# 
public void ToByteArray( 
   byte[] bytes,
   int offset
)

Parameters

bytes
offset

Exceptions

ExceptionDescription
System.ArgumentNullExceptionThe exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method that does not accept it as a valid argument.
System.ArgumentOutOfRangeExceptionThe exception that is thrown when the value of an argument is outside the allowable range of values as defined by the invoked method.

Example

Library/Library.Test/TestDbGuid.cs

C#Copy Code
DbGuid testA = DbGuid.NewGuid();
byte[] bytes = new byte[1024];
testA.ToByteArray(bytes, 512);
DbGuid testB = new DbGuid(bytes, 512);
Assert.AreEqual(testA, testB);
VB.NETCopy Code
Dim testA As DbGuid = DbGuid.NewGuid()
Dim bytes As Byte() = New Byte(1024) {}
testA.ToByteArray(bytes, 512)
Dim testB As New DbGuid(bytes, 512)
Assert.AreEqual(testA, testB)

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys